package com.example.sps.utils;

import com.alibaba.druid.sql.visitor.functions.Now;
import com.example.sps.commons.Constants;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.UUID;

/**
 * @ProjectName: Sps
 * @Titile: MD5Utils
 * @Author: nency
 * @Description: TODO
 */
public class MD5Utils {
    public static String enctype(String password,String salt,int times){
        password = password +salt;
        for (int i = 0; i < times; i++) {
            password = DigestUtils.md5DigestAsHex(password.getBytes(StandardCharsets.UTF_8));
        }
        return password;
    }
//    private static final long BEGIN_TIMESTAMP = 1704067200L;
    public static void main(String[] args) {
//        String salt = "cqupt20240719";
//        String password = enctype("123456", salt, Constants.HASH_TIME);
//        System.out.println(password);

//        System.out.println(LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)-BEGIN_TIMESTAMP);
    }
}